package com.fh.controller.swagger;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.fh.annotation.IgnoreAuth;
import com.fh.service.penalty_interest_reduction.IReducteOverdueInfoService;
import com.fh.util.R;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(value = "api")
@Controller
@RequestMapping("/api")
public class ReturnFeeController {

	
	@Autowired
	private IReducteOverdueInfoService service;
	
	private Logger loger = LoggerFactory.getLogger(ReturnFeeController.class);


	@RequestMapping(value = "/returnFee", method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation(value = "清结算审核罚息退回", httpMethod = "POST")
	@IgnoreAuth
	public R returnFee(@RequestParam(required = true) String order_no,@RequestParam(required = true) Integer status) {
		//修改状态
		loger.info(String.format("清结算审核罚息退回:ReturnFeeController returnFee order_no:", order_no));
		try {
			int count = service.updateReturnFeeStatus(order_no,status);
			if (count == 0) {
				return R.error("失败");
			}
		} catch (Exception e) {
			return R.error("失败");
		}
		return R.ok().put("msg", "成功");
	}


}
